package com.helei.consumser.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class consumerController {
    @Autowired
    RestTemplate restTemplate;
    @Value("${server-url.nacos-user-service}")
    private String server_url;

    @RequestMapping(value = "/consumer/{id}")
    public String aa(@PathVariable("id") Long id) {
        return restTemplate.getForObject(server_url+"/echo/" + id, String.class);
    }
}
